#ifndef MAINVIEW_H
#define MAINVIEW_H

#include <GL/glew.h>
#include <QGLWidget>
#include <QTimer>

#include "scene.h"
#include "scenebasic.h"
#include <FluidGridSimulator.h>


class MyGLWidget : public QGLWidget
{
    Q_OBJECT

private:
    Scene * scene;
    SceneBasic bscene;


    QPoint lastPos;
    float vTran[3];
    float vRot[3];
	int g_width;
	int g_height;
	int timer;
	bool ispaused;

	FluidGridSimulator* fluidSimulator;

public:
    MyGLWidget(const QGLFormat &format, QWidget *parent = 0);
    ~MyGLWidget();

    Scene* getScene()
    {
        return scene;
    }

	void pauseAnimation()
	{
		//killTimer(timer);
		ispaused = true;
	}

	void playAnimation()
	{
		ispaused = false;
		timer = startTimer(0);
	}

	void resetAnimation()
	{
		fluidSimulator->resetDensity();
		fluidSimulator->resetVelocity();
		fluidSimulator->resetTemperature();
	}

protected:
    void initializeGL();
    void paintGL();
    void resizeGL(int w, int h);
    void mousePressEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
	void mouseReleaseEvent(QMouseEvent *);
	void timerEvent(QTimerEvent *);
	void computeLightSource();

signals:
    
public slots:
    void takeScreenShot();
    void changeNPRMode(int);
	void changeContourStrokeSize(int);
	void changeScanlinePaceX(int);
	void changeScanlinePaceY(int);
	void changeContourTexture(int);
	void changeDmaxValue(int);
	void changeFactorValue(int);
	void changePointSize(int);
	void changeHatchStrokeSize(int);
	void changeHatchTexture(int);
	void changeKValue(int);
	void setRenderContour(int);
	void changeSmoothness(int);
	void setRenderBounding(int);
	void set2Dsmooth(int);
	void changeAdvectStep(int);
	void changeEdgeThres(int);
	void setContourEnhance(int);
	void changeLightAlpha(int);
	void changeLightPhi(int);
	void changeBillboardContour(int);
	void changeHatchEdgeThres(int);
	void changeNSlices(int);
	void setSubsampling(int);
};

#endif // MAINVIEW_H
